package com.pphh.demo;

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.extension.Activate;
import com.alibaba.dubbo.rpc.*;

/**
 * Please add description here.
 *
 * @author huangyinhuang
 * @date 11/12/2018
 */
@Activate(group = {Constants.CONSUMER})
public class TraceFilter implements com.alibaba.dubbo.rpc.Filter {

    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        // send the traceId to provider side.
        RpcContext.getContext().setAttachment("traceId", TraceId.get());
        return invoker.invoke(invocation);
    }

}
